package com.yunlan.friendscenter.exception;

import com.yunlan.friendscenter.common.ErrorCode;
import lombok.Data;

/**
 * Author: Wang
 * Date: 2022/5/2 16:18
 * 全局异常处理类
 */
@Data
public class BusinessException extends RuntimeException{
  private final int code;
  private final String description;

  public BusinessException(String message, int code, String description, int code1, String description1){
      super(message);
      this.code = code;
      this.description = description;
  }

    public BusinessException(ErrorCode errorCode){
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description = errorCode.getDescription();
    }

    public BusinessException(ErrorCode errorCode,String description){
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description = description;
    }
}
